<!DOCTYPE html>
<html>
<meta charset="utf-8">
<head th:include="include :: header"></head>
<body class="gray-bg">
	<div class="wrapper wrapper-content ">
		<div class="row">
			<div class="col-sm-12">
				<div class="ibox float-e-margins">
					<div class="ibox-content">
						<form class="form-horizontal m-t" id="signupForm">
							<div class="form-group">
								<label class="col-sm-3 control-label">日期：</label>
								<div class="col-sm-8">
									<input id="dt" name="dt" class="form-control" type="date">
								</div>
							</div>
							<div class="form-group">
								<label class="col-sm-3 control-label">开始时间：</label>
								<div class="col-sm-8">
									<input id="st" name="st" class="form-control"
										type="time">
								</div>
							</div>
							<div class="form-group">
								<label class="col-sm-3 control-label">结束时间：</label>
								<div class="col-sm-8">
									<input id="et" name="et" class="form-control"
										type="time">
								</div>
							</div>
							<div class="form-group">
								<label class="col-sm-3 control-label">号源数：</label>
								<div class="col-sm-8">
									<input id="num" name="num" class="form-control" placeholder="请输入号源数量。。"
										   type="number">
								</div>
							</div>
							<div class="form-group">
								<div class="col-sm-8 col-sm-offset-3">
									<button type="button" class="btn btn-primary" onclick="save()">提交</button>
								</div>
							</div>
						</form>
					</div>
				</div>
			</div>
		</div>

	</div>
	<div th:include="include::footer"></div>
<!--	<script type="text/javascript" src="/js/appjs/sys/doc/pfAdd.js">-->
	</script>
</body>
</html>

<script>
	function save() {
		var dt = $('#dt').val();
		if(dt == null || dt === ''){
			layer.msg("请输入日期！");
			return;
		}
		var st = $('#st').val();
		if(st == null || st === ''){
			layer.msg("请输入当日就诊开始时间！");
			return;
		}
		var et = $('#et').val();
		if(et == null || et === ''){
			layer.msg("请输入当日就诊结束时间！");
			return;
		}
		var num = $('#num').val();
		if(num == null || num <= 0){
			layer.msg("请输入有效的数量！");
			return;
		}

		$.ajax({
			cache : true,
			type : "POST",
			url : "/system/doc/pbAdd",
			data : $('#signupForm').serialize(),// 你的formid
			async : false,
			error : function(request) {
				parent.layer.alert("Connection error");
			},
			success : function(data) {
				if (data.code === 0) {
					parent.layer.msg("操作成功");
					parent.reLoad();
					var index = parent.layer.getFrameIndex(window.name); // 获取窗口索引
					parent.layer.close(index);

				} else {
					parent.layer.alert(data.msg)
				}

			}
		});

	}
</script>
